// written by entire team
//empty the ouput folder for each new run
//hours rounded to the hour and days are in the format YYYYMMDD
#include "HTMLOutputter.h"
#include "Event.h"
#include "Appt.h"
#include "XMLParser.h"
#include "Filter.h"
#include <iostream>
#include <cctype>
#include "EventProcessor.h"
#include <sstream>
#include "Comparator.h"

const string f = "-f";
const string empty = "";
const string space = " ";

int main(int argc, char* argv[]){
	
	
	//simple way of loading in multiple files
	EventProcessor process;
	for(int k=0; k< argc; k++)
	{
		cout<<"Reading file " << argv[k] << " ...";
		XMLParser parser(argv[k]);
		cout<<"done."<<endl;
		
		cout<<"Processing file " << argv[k] << " ...";
		//new XMLParser should return a vector<Event*>
		process.add(parser.getEvents());
		cout<<"done." << endl;
	}
	
	//Early testing
	/*int whichEvent = 1;
	XMLParser parser("schedule.xml", whichEvent);
	vector<Event> events = parser.getEvents();
	*/
	
	/*some tests
	sort(testEvents.begin(), testEvents.end(), Comparitor<Event> (new Sorter<Event>()));
	for(unsigned int k = 0; k< testEvents.size()-1; k++)
	{
		Event a = testEvents.at(k);
		cout << a.getDay() << space << a.getDescription()<<endl;
		cout << " is same as next Event ";
		if(a==testEvents[k+1])
			cout << "true";
		else cout << "false";
		cout << endl;
	}
	*/
	
	HTMLOutputter out;
	
	cout<<"Outputting...";
	process.generateHTML(out);
	cout<<"done."<<endl;
	
	cout<<"Program completed."<<endl;
	
	return 0;
}
